﻿@model CoralNode.CoralFile.Entity.Domains.FileStoreDomain

@{
    Layout = null;
}
<form method="POST" class="j_updateFile" action="/m/file/updateFile">
    <div id="upload_d">
        <div class="upload_d_t">
            修改图片信息
        </div>
        <div id="imgselectarea" style="position: relative;">
        </div>
        <div class="cutbox clearfix">
            <div class="clearfix">
                <div class="item">
                    <div id="loadImage">
                        <img src="@Model.Path" id="loadedImage" height="100"/>
                        <div class="tipmessage">
                            &nbsp;&nbsp;&nbsp;大小：@Coralcode.Adapter.File.Utils.FileUtil.FormatSize(Convert.ToInt32(Model.Size))
                        </div>
                    </div>
                </div>
                <div>标题不允许出现单引号和双引号</div>
                  <div class="j_message"></div>
            </div>
            <div class=" form_main  table_form ">
                <table>
                    <tr>
                        <td width="60">标题：</td>
                        <td>
                            <input type="text" class="text w_41" name="Title" value="@Model.Title"/>
                            @Html.HiddenFor(n=>n.Id)
                        </td>
                    </tr>
                    <tr>
                        <td>描述：</td>
                        <td>
                            @{
                                var id = DateTime.Now.ToString();
                            }
                            <textarea id="@id" name="Description" style="height: 300px">@Model.Description</textarea>
                            <script type="text/javascript">
                                var edit = UE.getEditor('@id', { initialFrameWidth: 600 });
                            </script>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div class="opbtnbox clearfix">
            <span class="btn btn_green_normal w_8 okbtn">确定</span><span class="btn pl_2 cancelbtn">取消</span>
        </div>
    </div>
</form>
<script>
    $(function () {
        var d_outer = $("#upload_d").parents(".d-outer");
        var dialog = d_outer.data("cutDialog");
        var param = d_outer.data("params");
        $("#upload_d .cancelbtn").click(function (e) {
            e.preventDefault();
            dialog.close();
        });
        $('.okbtn').click(function() {
            var $form = $('#upload_d').parent();
            $.post($form.attr("action"), $form.serialize(), function (data) {
                if (data.Type == 5) {
                    $('.j_message').text(data.Msg);
                    if (param.okfun != null && param.okfun != "") {
                        var title = $form.find('input[name="Title"]').val();
                        var description = $form.find('textarea[name="Description"]').val();
                        var jsonObj = { filePath: "@Model.Path", title: title, description: encodeURIComponent(description) };
                        if (typeof (param.okfun) === "function") {
                            param.okfun(jsonObj);
                        }
                        else if (typeof (eval(param.okfun)) === "function") {
                            eval(param.okfun + "(jsonObj)");
                        }
                        dialog.close();
                    }
                }
            });
        });      
       
    });
</script>